<?php

namespace app\controller;
use app\BaseController;
use think\facade\Request;
use think\facade\Config;
use think\facade\Db;
use think\facade\Session;
class News extends BaseController
{

    // http://www.penyou.com/News/lists
    public function lists($code){
        $catInfo = Db::name('news_cats')->field('id,title,pid')->where("code = '".$code."'")->find();
        $lists = Db::name('news')->field('id,title')->order('ord ASC')->where("cat_id = ".$catInfo['id']." AND is_delete = 0 AND is_show = 1")->select();

        singleJson($lists);
    }

    public function detail(){
        $id = Request::param('id');
        $detail = Db::name('news')->field('id,title,content')->where("id = ".$id." AND is_delete = 0")->find();

        singleJson($detail);

    }



}
